<template>
    <div>
<van-contact-card type="add" @click="onAdd" icon="location-o" />
<p>店铺名称</p>
<van-card
  num="2"
  price="2.00"
  desc="描述信息"
  title="商品标题"
  thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
/>
<!-- 优惠券单元格 -->
<van-coupon-cell
  :coupons="coupons"
  :chosen-coupon="chosenCoupon"
  @click="showList = true"
/>
<van-coupon-cell
  :coupons="coupons"
  :chosen-coupon="chosenCoupon"
  @click="showList = true"
/>
<!-- 优惠券列表 -->
<van-popup
  v-model:show="showList"
  round
  position="bottom"
  style="height: 90%; padding-top: 4px;"
>
  <van-coupon-list
    :coupons="coupons"
    :chosen-coupon="chosenCoupon"
    :disabled-coupons="disabledCoupons"
    @change="onChange"
    @exchange="onExchange"
  />
</van-popup>
<van-cell-group>
  <van-cell title="商业金额" value="￥2435467534656" />
  <van-cell title="优惠金额" value="￥0" />
  <van-cell title="运费" value="免运费" />
  <van-cell title="备注" value="请输入备注" />
</van-cell-group>
<van-submit-bar :price="3050" button-text="提交订单" @submit="onSubmit" />
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { showToast } from 'vant';
import router from '@/router';
   const onAdd = () => {
    router.push('/dz')
   }
      const onSubmit = () => showToast('点击按钮');


    const coupon = {
      available: 1,
      condition: '无门槛\n最多优惠12元',
      reason: '',
      value: 150,
      name: '优惠券名称',
      startAt: 1489104000,
      endAt: 1514592000,
      valueDesc: '1.5',
      unitDesc: '元',
    };

    const coupons = ref([coupon]);
    const showList = ref(false);
    const chosenCoupon = ref(-1);

    const onChange = (index) => {
      showList.value = false;
      chosenCoupon.value = index;
    };
    const onExchange = (code) => {
      coupons.value.push(coupon);
    };
  

</script>

<style lang="scss" scoped>

</style>